**********************************************************************************************************
* Do-file to analyze Attitudinal consistency in citizens' social policy preferences
* September 2023
* Whole syntax must be run at once
**********************************************************************************************************

*+++++++++++++++++++++++++++++++PREAMBLE+++++++++++++++++++++++++++++++++++++* 

capture: cd "" // Set path to directory where replication package was unzipped

global original "00_original_data/"  
global do "01_do_files/"  
global output "02_output/"  
global aux "03_aux/"    

*******************
* ADOs
*******************
*ssc install estout, replace 
*ssc install blindschemes, replace 
*ssc install coefplot, replace

log using ${output}replication_AttitudinalConsistency, replace text
use ${original}welfarepriorities_replication.dta, clear

set scheme plottig

**********************
* Variable management:
**********************

* Standardize rating and tradeoff items
foreach var of varlist rr_exp_minpen-rf_ret_immig {
	egen `var'_stdby = std(`var')
}

foreach var of varlist tradeoff_unemppen tradeoff_childpen tradeoff_univ {
	egen `var'_stdby = std(`var')
}

foreach var of varlist exp_unemp exp_child exp_univ ret_univ {
	egen `var'_stdby = std(`var')
}

* Measure inconsistent replies to items capturing support for expansion and retrenchment of the same policy
* Categorical variable 1=disagree (not expand nor retrench) 2=agree (to expand or retrench)
global fields "pension child univ unemp almp immig"

foreach var of varlist exp_pension-ret_immig {
	recode `var' (1/2=1) (3/4=2), gen(`var'_rec)
}

* Measuring number of inconsistent responses to priority rating items

* Indicator of whether points are 17 or above for a certain field

foreach n of global fields {
		gen exp_`n'_ind = 0
		recode exp_`n'_ind (0 = 1) if rf_exp_`n' > 16
		gen ret_`n'_ind = 0
		recode ret_`n'_ind (0=1) if rf_ret_`n' > 16
}

foreach n of global fields {
		gen inc_`n'_rat = 0
		recode inc_`n'_rat (0=1) if exp_`n'_ind==1 & ret_`n'_ind==1
		gen ind_`n'_rat = 0
		recode ind_`n'_rat (0=1) if exp_`n'_ind==0 & ret_`n'_ind==0
		gen exp_`n'_rat = 0
		recode exp_`n'_rat (0=1) if exp_`n'_ind==1 & ret_`n'_ind==0
		gen ret_`n'_rat = 0
		recode ret_`n'_rat (0=1) if exp_`n'_ind==0 & ret_`n'_ind==1
}

	foreach n of global fields {
		gen cat_`n' = .
		recode cat_`n' (.=1) if inc_`n'_rat==1 // inconsistent
		recode cat_`n' (.=2) if ind_`n'_rat==1 // indifferent
		recode cat_`n' (.=3) if ret_`n'_rat==1 // retrenchment
		recode cat_`n' (.=4) if exp_`n'_rat==1 // expension
	}

label define cat_values 1"Inconsistent" 2"Indifferent" 3"Retrenchment" 4"Expansion"
foreach n of global fields {
	label values cat_`n' cat_values
}

* Generate six binary variables capturing inconsistent replies (=1) or non-inconsistent (=0)
foreach n of global fields {
	recode cat_`n' (2/4=0), gen(bin_`n')
}

label var bin_pension "Old age pensions"
label var bin_child "Childcare"
label var bin_univ "University Education"
label var bin_unemp "Unemployment Benefits"
label var bin_almp "Labor Market Reintegration Services"
label var bin_immig "Services for Migrants' LM Integration"

label var trade_off "Perceptions of tradeoffs"


* Count of number of inconsistent responses per respondent
egen total_incons = rowtotal(inc_*)

*-------------------------------------------------------------------------------
* ANALYSES IN THE MAIN TEXT
*-------------------------------------------------------------------------------

*-------------------------------------------------------------------------------
* Section 4.1: Logical consistency in social policy preferences
*-------------------------------------------------------------------------------

*** Table 1: Percentage of respondents who support expansion and retrenchment in support questions

label var exp_pension_rec "Old age pension benefits"
label var ret_pension_rec "Old age pension benefits"
label var exp_unemp_rec "Unemployment benefits"
label var ret_unemp_rec "Unemployment benefits"
label define expand 1"Opposition to expansion" 2"Support for expansion"
label define retrench 1"Opposition to retrenchment" 2"Support for retrenchment"
label values exp_pension_rec expand
label values exp_unemp_rec expand
label values ret_unemp_rec retrench
label values ret_pension_rec retrench

*** Table 1: Percentage of respondents who support expansion and retrenchment in support questions
estpost tab exp_pension_rec ret_pension_rec
esttab using ${output}Table1.rtf, cell(pct(fmt(2))) unstack label collabels(none) varlabels(, blist(Total "{hline @width}{break}")) eqlabels(, lhs("Old age pension benefits")) nonumbers drop(Total) noobs

estpost tab exp_unemp_rec ret_unemp_rec
esttab using ${output}Table1.rtf, cell(pct(fmt(2))) unstack label collabels(none) varlabels(, blist(Total "{hline @width}{break}")) eqlabels(, lhs("Unemployment benefits")) nonumbers drop(Total) append

*** Figure 1: Proportion of inconsistent responses in priority rating items
graph hbar bin_pension bin_child bin_univ bin_unemp bin_almp bin_immig, ascategory scheme(plottig) ytitle(Proportion of inconsistent preferences) yvar(relabel(1 "`: var label bin_pension'" 2 "`: var label bin_child'" 3 "`: var label bin_univ'" 4 "`: var label bin_unemp'" 5 "`: var label bin_almp'" 6 "`: var label bin_immig'")) blabel(bar, position(center) format(%9.3f) size(small) color(black)) 
graph save ${output}Figure1.gph

*-------------------------------------------------------------------------------
* Section 4.2: Relational consistency in social policy preferences
*-------------------------------------------------------------------------------

gen expansion=.
label var expansion "Support for Expansion"
gen retrenchment=.
label var retrenchment "Support for Retrenchment"

* Tradeoff 1: Higher benefits for the unemployed – lowering maximum old-age pension benefits
* Run analyses and save estimates
preserve
replace expansion=rf_exp_unemp_stdby
replace retrenchment=rr_ret_maxpen_stdby

eststo sd_1:reg tradeoff_unemppen_stdby expansion retrenchment i.country
est store toff1_NC

eststo sd_2:reg tradeoff_unemppen_stdby expansion retrenchment c.age##c.age female education_rec income pol_interest trade_off i.country
est store toff1_C

restore

* Tradeoff 2: Higher availability of childcare - lower maximum pension
preserve
replace expansion=rr_exp_child_stdby
replace retrenchment=rr_ret_maxpen_stdby

eststo sd_3:reg tradeoff_childpen_stdby expansion retrenchment i.country
est store toff2_NC

eststo sd_4:reg tradeoff_childpen_stdby expansion retrenchment c.age##c.age female education_rec income pol_interest trade_off i.country
est store toff2_C

restore

* Tradeoff 3: Higher support for university means-tested – higher fees for university means-tested
preserve
replace expansion=rr_exp_univli_stdby
replace retrenchment=rr_ret_univhi_stdby

eststo sd_5:reg tradeoff_univ_stdby expansion retrenchment i.country
est store toff3_NC

eststo sd_6:reg tradeoff_univ_stdby expansion retrenchment c.age##c.age female education_rec income pol_interest trade_off i.country
est store toff3_C
restore

*** Figure 2: Relationship between acceptability of a welfare policy tradeoff and preferences on the two social policies in the tradeoff

coefplot toff1_NC toff1_C || toff2_NC toff2_C || toff3_NC toff3_C, keep(expansion retrenchment) plotlabels("Without controls" "With controls") bylabels(`" "Expand unemployment vs."  "retrench max. pensions" "' `""Expand childcare vs."  "retrench max. pensions" "' `""Means-tested university"  "support and fees" "') byopts(cols(3) legend(position(6))) xline(0) xscale(range(0.05 0.30))
graph save ${output}Figure2.gph

*** Table Appendix 7: Rating of expansion and retrenchment elements of a tradeoff as determinants of preferences on the respective tradeoff (additive OLS estimation)
esttab sd_*		using 	${output}Appendix7.rtf, ///
					b(3) se(3) 			  ///
					eqlabel(none) ///
					nonumber mtitles("Expand unemployment vs. retrench max. pensions" "Expand unemployment vs. retrench max. pensions" "Expand childcare vs. retrench max. pensions" "Expand childcare vs. retrench max. pensions" "Means-tested university support and fees" "Means-tested university support and fees") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress label ///
					drop(*country) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

drop expansion
drop retrenchment    

*-----------------------------------------------------------------------------------
* Section 4.3: Heterogeneity in attitudinal consistency in social policy preferences
*-----------------------------------------------------------------------------------

eststo b: reg total_incons c.age##c.age female education_rec income pol_interest trade_off i.country

*** Appendix 9: Results from OLS regression of the number of inconsistent preferences on individual-level factors
esttab b		using 	${output}Appendix9.rtf, ///
					b(3) se(3) 			  ///
					eqlabel(none) ///
					nonumber mtitles("Number of inconsistent preferences") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress ///
					label ///
					drop(*country) ///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

*** Figure 3: Linear effects of socio-demographic characteristics on number of inconsistent preferences with 95 percent confidence intervals
coefplot, drop (*.country _cons) xline(0) ylabel(1"Age" 2"Age squared" 3"Female" 4"Education level" 5"Income" 6"Political interest" 7"Tradeoff perceptions", labsize(vsmall)) xlabel(, labsize(small)) xtitle(Effect on number of inconsistent preferences)
graph save ${output}Figure3.gph


* Estimate and save interactive models behind Figure 4
gen expansion=.
label var expansion "Support for Expansion"
gen retrenchment=.
label var retrenchment "Support for Retrenchment"

* Tradeoff 1: Higher benefits for the unemployed – lowering maximum old-age pension benefits
preserve
replace expansion=rf_exp_unemp_stdby
replace retrenchment=rr_ret_maxpen_stdby

eststo tradeoff1_1: reg 	tradeoff_unemppen_stdby c.expansion##c.age##c.age c.retrenchment##c.age##c.age female education_rec pol_interest income trade_off i.country
est store t1_int1

eststo tradeoff1_2: reg 	tradeoff_unemppen_stdby c.expansion##i.female c.retrenchment##i.female c.age##c.age education_rec pol_interest income trade_off i.country
est store t1_int2

eststo tradeoff1_3: reg 	tradeoff_unemppen_stdby c.expansion##c.education_rec c.retrenchment##c.education_rec c.age##c.age  female pol_interest income trade_off i.country
est store t1_int3

eststo tradeoff1_4: reg 	tradeoff_unemppen_stdby c.expansion##c.pol_interest c.retrenchment##c.pol_interest c.age##c.age  female education_rec income trade_off i.country
est store t1_int4

eststo tradeoff1_5: reg 	tradeoff_unemppen_stdby c.expansion##c.income c.retrenchment##c.income c.age##c.age  female education_rec pol_interest trade_off i.country
est store t1_int5

eststo tradeoff1_6: reg 	tradeoff_unemppen_stdby c.expansion##c.trade_off c.retrenchment##c.trade_off c.age##c.age  female education_rec pol_interest income i.country
est store t1_int6

restore

esttab tradeoff1*		using 	${output}Appendix12_1.rtf, replace ///
					b(3) se(3) 			  ///
					label   	interaction(" X ")		///
					eqlabel(none) ///
					nonumber mtitles("Expand unemployment vs. retrench max. pensions" "Expand unemployment vs. retrench max. pensions" "Expand unemployment vs. retrench max. pensions" "Expand unemployment vs. retrench max. pensions" "Expand unemployment vs. retrench max. pensions" "Expand unemployment vs. retrench max. pensions") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress ///
					drop(*country) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

					
* Tradeoff 2: Higher availability of childcare - lower maximum pension
preserve
replace expansion=rr_exp_child_stdby
replace retrenchment=rr_ret_maxpen_stdby

eststo tradeoff2_1: reg 	tradeoff_childpen_stdby c.expansion##c.age##c.age c.retrenchment##c.age##c.age female education_rec pol_interest income trade_off i.country
est store t2_int1

eststo tradeoff2_2: reg 	tradeoff_childpen_stdby c.expansion##i.female c.retrenchment##i.female c.age##c.age  education_rec pol_interest income trade_off i.country
est store t2_int2

eststo tradeoff2_3: reg 	tradeoff_childpen_stdby c.expansion##c.education_rec c.retrenchment##c.education_rec c.age##c.age  female pol_interest income trade_off i.country
est store t2_int3

eststo tradeoff2_4: reg 	tradeoff_childpen_stdby c.expansion##c.pol_interest c.retrenchment##c.pol_interest c.age##c.age  female education_rec income trade_off i.country
est store t2_int4

eststo tradeoff2_5: reg 	tradeoff_childpen_stdby c.expansion##c.income c.retrenchment##c.income c.age##c.age  female education_rec pol_interest income trade_off i.country
est store t2_int5

eststo tradeoff2_6: reg 	tradeoff_childpen_stdby c.expansion##c.trade_off c.retrenchment##c.trade_off c.age##c.age  female education_rec pol_interest income i.country
est store t2_int6

restore

esttab tradeoff2*		using 	${output}Appendix12_2.rtf, replace ///
					b(3) se(3) 			  ///
					label   	interaction(" X ")		///
					eqlabel(none) ///
					nonumber mtitles("Expand childcare vs. retrench max. pensions" "Expand childcare vs. retrench max. pensions" "Expand childcare vs. retrench max. pensions" "Expand childcare vs. retrench max. pensions" "Expand childcare vs. retrench max. pensions" "Expand childcare vs. retrench max. pensions") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress ///
					drop(*country) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

* Tradeoff 3: Higher support for university means-tested – higher fees for university means-tested
preserve
replace expansion=rr_exp_univli_stdby
replace retrenchment=rr_ret_univhi_stdby

eststo tradeoff3_1: reg 	tradeoff_univ_stdby c.expansion##c.age##c.age c.retrenchment##c.age##c.age female education_rec pol_interest income trade_off i.country
est store t3_int1

eststo tradeoff3_2: reg 	tradeoff_univ_stdby c.expansion##i.female c.retrenchment##i.female c.age##c.age  education_rec pol_interest income trade_off i.country
est store t3_int2

eststo tradeoff3_3: reg 	tradeoff_univ_stdby c.expansion##c.education_rec c.retrenchment##c.education_rec c.age##c.age  female pol_interest income trade_off i.country
est store t3_int3

eststo tradeoff3_4: reg 	tradeoff_univ_stdby c.expansion##c.pol_interest c.retrenchment##c.pol_interest c.age##c.age female education_rec income trade_off i.country
est store t3_int4

eststo tradeoff3_5: reg 	tradeoff_univ_stdby c.expansion##c.income c.retrenchment##c.income c.age##c.age female education_rec pol_interest income trade_off i.country
est store t3_int5

eststo tradeoff3_6: reg 	tradeoff_univ_stdby c.expansion##c.trade_off c.retrenchment##c.trade_off c.age##c.age female education_rec pol_interest income i.country
est store t3_int6

restore

esttab tradeoff3*		using 	${output}Appendix12_3.rtf, replace ///
					b(3) se(3) 			  ///
					label   	interaction(" X ")		///
					eqlabel(none) ///
					nonumber mtitles("Expand support for low-income vs. higher fees for high-income" "Expand support for low-income vs. higher fees for high-income" "Expand support for low-income vs. higher fees for high-income" "Expand support for low-income vs. higher fees for high-income" "Expand support for low-income vs. higher fees for high-income" "Expand support for low-income vs. higher fees for high-income") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress ///
					drop(*country) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

drop expansion
drop retrenchment

*** Figure 4: Heterogeneity in the relationship between acceptability of a welfare policy tradeoff and preferences concerning the expansion and retrenchment of the two social policies in the tradeoff

coefplot t1_int* || t2_int* || t3_int*, keep(c.expansion#c.age c.retrenchment#c.age c.expansion#c.age#c.age c.retrenchment#c.age#c.age 1.female#c.expansion 1.female#c.retrenchment c.expansion#c.education_rec c.retrenchment#c.education_rec c.expansion#c.pol_interest c.retrenchment#c.pol_interest c.expansion#c.income c.retrenchment#c.income c.expansion#c.trade_off c.retrenchment#c.trade_off) xline(0) coeflabels(c.expansion#c.age = "Expansion*Age" c.retrenchment#c.age= "Retrenchment*Age" c.expansion#c.age#c.age="Expansion*Age{superscript:2}" c.retrenchment#c.age#c.age="Retrenchment*Age{superscript:2}" 1.female#c.expansion= "Expansion*Female" 1.female#c.retrenchment="Retrenchment*Female" c.expansion#c.education_rec= "Expansion*Education" c.retrenchment#c.education_rec= "Retrenchment*Education" c.expansion#c.pol_interest= "Expansion*Political interest" c.retrenchment#c.pol_interest= "Retrenchment*Political interest" c.expansion#c.income= "Expansion*Income" c.retrenchment#c.income="Retrenchment*Income" c.expansion#c.trade_off= "Expansion*Tradeoff perc." c.retrenchment#c.trade_off="Retrenchment*Tradeoff perc.") legend(off) byopts(cols(3) legend(off)) bylabels(`" "Expand unemployment vs."  "retrench max. pensions" "' `""Expand childcare vs."  "retrench max. pensions" "' `""Means-tested university"  "support and fees" "')
graph save ${output}Figure4.gph

*-------------------------------------------------------------------------------
* ADDITIONAL ANALYSES IN THE APPENDIX
*-------------------------------------------------------------------------------

* Appendix 3: Correlation matrices between support items and correlations with ideological placement
preserve
label var exp_pension "Old age pensions" 
label var ret_pension "Old age pensions"
label var exp_child "Childcare services"
label var ret_child "Increasing fees for childcare services"
label var exp_univ "University education for low-income students"
label var ret_univ "Increasing university fees for middle- and higher-income students"
label var exp_unemp "Unemployment benefits"
label var ret_unemp "Unemployment benefits"
label var exp_almp "Labor-market reintegration services for the unemployed"
label var ret_almp "Restricting reintegration services to long-term unemployed only"


* Appendix 3.1: Correlation matrix between respondents' agreement with expansion in social policies
eststo clear
estpost correlate exp_pension exp_child exp_univ exp_unemp exp_almp, matrix listwise
esttab using ${output}Appendix3_1.rtf, unstack label compress b(4) nostar nonumbers


* Appendix 3.2: Correlation matrix between respondents' agreement with retrenchment in social policies
eststo clear
estpost correlate ret_pension ret_child ret_univ ret_unemp ret_almp, matrix listwise
esttab using ${output}Appendix3_2.rtf, unstack label compress b(4) nostar nonumbers

* Appendix 3.3: Correlation between ideological placement and support for welfare expansion
eststo clear
estpost correlate ideology exp_pension exp_child exp_univ exp_unemp exp_almp, listwise
esttab using ${output}Appendix3_3.rtf, unstack label compress b(4) nostar nonumbers

* Appendix 3.4: Correlation between ideological placement and support for welfare retrenchment
eststo clear
estpost correlate ideology ret_pension ret_child ret_univ ret_unemp ret_almp, listwise
esttab using ${output}Appendix3_4.rtf, unstack label compress b(4) nostar nonumbers
restore

* Appendix 4: Proportion of logically inconsistent preferences at varying thresholds of rating points for dichotomization
graph hbar bin_pension bin_child bin_univ bin_unemp bin_almp bin_immig, ascategory scheme(plottig) ytitle(Proportion of inconsistent preferences) yvar(relabel(1 "`: var label bin_pension'" 2 "`: var label bin_child'" 3 "`: var label bin_univ'" 4 "`: var label bin_unemp'" 5 "`: var label bin_almp'" 6 "`: var label bin_immig'")) blabel(bar, position(center) format(%9.3f) size(small) color(black)) title("Threshold at 17")
graph save ${output}Appendix4_Threshold17.gph

* At 30 points as the threshold
foreach n of global fields {
		gen exp_`n'_ind2 = 0
		recode exp_`n'_ind2 (0 = 1) if rf_exp_`n' > 30
		gen ret_`n'_ind2 = 0
		recode ret_`n'_ind2 (0=1) if rf_ret_`n' > 30
}

foreach n of global fields {
		gen inc_`n'_rat2 = 0
		recode inc_`n'_rat2 (0=1) if exp_`n'_ind2==1 & ret_`n'_ind2==1
		gen ind_`n'_rat2 = 0
		recode ind_`n'_rat2 (0=1) if exp_`n'_ind2==0 & ret_`n'_ind2==0
		gen exp_`n'_rat2 = 0
		recode exp_`n'_rat2 (0=1) if exp_`n'_ind2==1 & ret_`n'_ind2==0
		gen ret_`n'_rat2 = 0
		recode ret_`n'_rat2 (0=1) if exp_`n'_ind2==0 & ret_`n'_ind2==1
}

	foreach n of global fields {
		gen cat2_`n' = .
		recode cat2_`n' (.=1) if inc_`n'_rat2==1 // inconsistent
		recode cat2_`n' (.=2) if ind_`n'_rat2==1 // indifferent
		recode cat2_`n' (.=3) if ret_`n'_rat2==1 // retrenchment
		recode cat2_`n' (.=4) if exp_`n'_rat2==1 // expension
	}

label define cat2_values 1"Inconsistent" 2"Indifferent" 3"Retrenchment" 4"Expansion"
foreach n of global fields {
	label values cat2_`n' cat2_values
}

foreach n of global fields {
	recode cat2_`n' (2/4=0), gen(bin2_`n')
}

label var bin2_pension "Old age pensions"
label var bin2_child "Childcare"
label var bin2_univ "University Education"
label var bin2_unemp "Unemployment Benefits"
label var bin2_almp "Labor Market Reintegration Services"
label var bin2_immig "Services for Migrants' LM Integration"

graph hbar bin2_pension bin2_child bin2_univ bin2_unemp bin2_almp bin2_immig, ascategory scheme(plottig) ytitle(Proportion of inconsistent preferences) yvar(relabel(1 "`: var label bin2_pension'" 2 "`: var label bin2_child'" 3 "`: var label bin2_univ'" 4 "`: var label bin2_unemp'" 5 "`: var label bin2_almp'" 6 "`: var label bin2_immig'")) blabel(bar, position(center) format(%9.3f) size(small) color(black)) title("Threshold at 30")
graph save ${output}Appendix4_Threshold30.gph

* At 45 points as the threshold
foreach n of global fields {
		gen exp_`n'_ind3 = 0
		recode exp_`n'_ind3 (0 = 1) if rf_exp_`n' > 45
		gen ret_`n'_ind3 = 0
		recode ret_`n'_ind3 (0=1) if rf_ret_`n' > 45
}

foreach n of global fields {
		gen inc_`n'_rat3 = 0
		recode inc_`n'_rat3 (0=1) if exp_`n'_ind3==1 & ret_`n'_ind3==1
		gen ind_`n'_rat3 = 0
		recode ind_`n'_rat3 (0=1) if exp_`n'_ind3==0 & ret_`n'_ind3==0
		gen exp_`n'_rat3 = 0
		recode exp_`n'_rat3 (0=1) if exp_`n'_ind3==1 & ret_`n'_ind3==0
		gen ret_`n'_rat3 = 0
		recode ret_`n'_rat3 (0=1) if exp_`n'_ind3==0 & ret_`n'_ind3==1
}

	foreach n of global fields {
		gen cat3_`n' = .
		recode cat3_`n' (.=1) if inc_`n'_rat3==1 // inconsistent
		recode cat3_`n' (.=2) if ind_`n'_rat3==1 // indifferent
		recode cat3_`n' (.=3) if ret_`n'_rat3==1 // retrenchment
		recode cat3_`n' (.=4) if exp_`n'_rat3==1 // expension
	}

label define cat3_values 1"Inconsistent" 2"Indifferent" 3"Retrenchment" 4"Expansion"
foreach n of global fields {
	label values cat3_`n' cat3_values
}

foreach n of global fields {
	recode cat3_`n' (2/4=0), gen(bin3_`n')
}

label var bin3_pension "Old age pensions"
label var bin3_child "Childcare"
label var bin3_univ "University Education"
label var bin3_unemp "Unemployment Benefits"
label var bin3_almp "Labor Market Reintegration Services"
label var bin3_immig "Services for Migrants' LM Integration"

graph hbar bin3_pension bin3_child bin3_univ bin3_unemp bin3_almp bin3_immig, ascategory scheme(plottig) ytitle(Proportion of inconsistent preferences) yvar(relabel(1 "`: var label bin3_pension'" 2 "`: var label bin3_child'" 3 "`: var label bin3_univ'" 4 "`: var label bin3_unemp'" 5 "`: var label bin3_almp'" 6 "`: var label bin3_immig'")) blabel(bar, position(center) format(%9.3f) size(small) color(black)) title("Threshold at 45")
graph save ${output}Appendix4_Threshold45.gph


* At 60 points as the threshold
foreach n of global fields {
		gen exp_`n'_ind4 = 0
		recode exp_`n'_ind4 (0 = 1) if rf_exp_`n' > 60
		gen ret_`n'_ind4 = 0
		recode ret_`n'_ind4 (0=1) if rf_ret_`n' > 60
}

foreach n of global fields {
		gen inc_`n'_rat4 = 0
		recode inc_`n'_rat4 (0=1) if exp_`n'_ind4==1 & ret_`n'_ind4==1
		gen ind_`n'_rat4 = 0
		recode ind_`n'_rat4 (0=1) if exp_`n'_ind4==0 & ret_`n'_ind4==0
		gen exp_`n'_rat4 = 0
		recode exp_`n'_rat4 (0=1) if exp_`n'_ind4==1 & ret_`n'_ind4==0
		gen ret_`n'_rat4 = 0
		recode ret_`n'_rat4 (0=1) if exp_`n'_ind4==0 & ret_`n'_ind4==1
}

	foreach n of global fields {
		gen cat4_`n' = .
		recode cat4_`n' (.=1) if inc_`n'_rat4==1 // inconsistent
		recode cat4_`n' (.=2) if ind_`n'_rat4==1 // indifferent
		recode cat4_`n' (.=3) if ret_`n'_rat4==1 // retrenchment
		recode cat4_`n' (.=4) if exp_`n'_rat4==1 // expension
	}

label define cat4_values 1"Inconsistent" 2"Indifferent" 3"Retrenchment" 4"Expansion"
foreach n of global fields {
	label values cat4_`n' cat4_values
}

foreach n of global fields {
	recode cat4_`n' (2/4=0), gen(bin4_`n')
}

label var bin4_pension "Old age pensions"
label var bin4_child "Childcare"
label var bin4_univ "University Education"
label var bin4_unemp "Unemployment Benefits"
label var bin4_almp "Labor Market Reintegration Services"
label var bin4_immig "Services for Migrants' LM Integration"

graph hbar bin4_pension bin4_child bin4_univ bin4_unemp bin4_almp bin4_immig, ascategory scheme(plottig) ytitle(Proportion of inconsistent preferences) yvar(relabel(1 "`: var label bin3_pension'" 2 "`: var label bin3_child'" 3 "`: var label bin3_univ'" 4 "`: var label bin3_unemp'" 5 "`: var label bin3_almp'" 6 "`: var label bin3_immig'")) blabel(bar, position(center) format(%9.3f) size(small) color(black)) title("Threshold at 60")
graph save ${output}Appendix4_Threshold60.gph


* At 75 points as the threshold
foreach n of global fields {
		gen exp_`n'_ind5 = 0
		recode exp_`n'_ind5 (0 = 1) if rf_exp_`n' > 75
		gen ret_`n'_ind5 = 0
		recode ret_`n'_ind5 (0=1) if rf_ret_`n' > 75
}

foreach n of global fields {
		gen inc_`n'_rat5 = 0
		recode inc_`n'_rat5 (0=1) if exp_`n'_ind5==1 & ret_`n'_ind5==1
		gen ind_`n'_rat5 = 0
		recode ind_`n'_rat5 (0=1) if exp_`n'_ind5==0 & ret_`n'_ind5==0
		gen exp_`n'_rat5 = 0
		recode exp_`n'_rat5 (0=1) if exp_`n'_ind5==1 & ret_`n'_ind5==0
		gen ret_`n'_rat5 = 0
		recode ret_`n'_rat5 (0=1) if exp_`n'_ind5==0 & ret_`n'_ind5==1
}

	foreach n of global fields {
		gen cat5_`n' = .
		recode cat5_`n' (.=1) if inc_`n'_rat5==1 // inconsistent
		recode cat5_`n' (.=2) if ind_`n'_rat5==1 // indifferent
		recode cat5_`n' (.=3) if ret_`n'_rat5==1 // retrenchment
		recode cat5_`n' (.=4) if exp_`n'_rat5==1 // expension
	}

label define cat5_values 1"Inconsistent" 2"Indifferent" 3"Retrenchment" 4"Expansion"
foreach n of global fields {
	label values cat5_`n' cat5_values
}

foreach n of global fields {
	recode cat5_`n' (2/4=0), gen(bin5_`n')
}

label var bin5_pension "Old age pensions"
label var bin5_child "Childcare"
label var bin5_univ "University Education"
label var bin5_unemp "Unemployment Benefits"
label var bin5_almp "Labor Market Reintegration Services"
label var bin5_immig "Services for Migrants' LM Integration"

graph hbar bin5_pension bin5_child bin5_univ bin5_unemp bin5_almp bin5_immig, ascategory scheme(plottig) ytitle(Proportion of inconsistent preferences) yvar(relabel(1 "`: var label bin3_pension'" 2 "`: var label bin3_child'" 3 "`: var label bin3_univ'" 4 "`: var label bin3_unemp'" 5 "`: var label bin3_almp'" 6 "`: var label bin3_immig'")) blabel(bar, position(center) format(%9.3f) size(small) color(black)) title("Threshold at 75")
graph save ${output}Appendix4_Threshold75.gph


* At 90 points as the threshold
foreach n of global fields {
		gen exp_`n'_ind6 = 0
		recode exp_`n'_ind6 (0 = 1) if rf_exp_`n' > 90
		gen ret_`n'_ind6 = 0
		recode ret_`n'_ind6 (0=1) if rf_ret_`n' > 90
}

foreach n of global fields {
		gen inc_`n'_rat6 = 0
		recode inc_`n'_rat6 (0=1) if exp_`n'_ind6==1 & ret_`n'_ind6==1
		gen ind_`n'_rat6 = 0
		recode ind_`n'_rat6 (0=1) if exp_`n'_ind6==0 & ret_`n'_ind6==0
		gen exp_`n'_rat6 = 0
		recode exp_`n'_rat6 (0=1) if exp_`n'_ind6==1 & ret_`n'_ind6==0
		gen ret_`n'_rat6 = 0
		recode ret_`n'_rat6 (0=1) if exp_`n'_ind6==0 & ret_`n'_ind6==1
}

	foreach n of global fields {
		gen cat6_`n' = .
		recode cat6_`n' (.=1) if inc_`n'_rat6==1 // inconsistent
		recode cat6_`n' (.=2) if ind_`n'_rat6==1 // indifferent
		recode cat6_`n' (.=3) if ret_`n'_rat6==1 // retrenchment
		recode cat6_`n' (.=4) if exp_`n'_rat6==1 // expension
	}

label define cat6_values 1"Inconsistent" 2"Indifferent" 3"Retrenchment" 4"Expansion"
foreach n of global fields {
	label values cat6_`n' cat6_values
}

foreach n of global fields {
	recode cat6_`n' (2/4=0), gen(bin6_`n')
}

label var bin6_pension "Old age pensions"
label var bin6_child "Childcare"
label var bin6_univ "University Education"
label var bin6_unemp "Unemployment Benefits"
label var bin6_almp "Labor Market Reintegration Services"
label var bin6_immig "Services for Migrants' LM Integration"

graph hbar bin6_pension bin6_child bin6_univ bin6_unemp bin6_almp bin6_immig, ascategory scheme(plottig) ytitle(Proportion of inconsistent preferences) yvar(relabel(1 "`: var label bin3_pension'" 2 "`: var label bin3_child'" 3 "`: var label bin3_univ'" 4 "`: var label bin3_unemp'" 5 "`: var label bin3_almp'" 6 "`: var label bin3_immig'")) blabel(bar, position(center) format(%9.3f) size(small) color(black)) title("Threshold at 90")
graph save ${output}Appendix4_Threshold90.gph

*** Appendix 5: Number of inconsistent replies to rating items provided by respondents
label var total_incons "Number of inconsistent responses"
estpost tab total_incons
esttab using ${output}Appendix5.rtf, cell(pct(fmt(2))) unstack nonumbers mtitle("Percentage of respondents with inconsistent priorities") collabels(none) drop(Total)

*** Appendix 6: Correlation between preferences for expansion and retrenchment (from rating tasks)

preserve

* Reshape data to long format (each line is an individualXsocial policy combination)
sort id
gen n = _n
sort n
expand 6
sort n 
by n: gen alt = _n 
rename alt field

gen rating_exp_stdby = .
gen rating_ret_stdby = .

replace rating_exp_stdby = rf_exp_pension_stdby if field==1
replace rating_ret_stdby = rf_ret_pension_stdby if field==1 

replace rating_exp_stdby = rf_exp_child_stdby if field==2
replace rating_ret_stdby = rf_ret_child_stdby if field==2 

replace rating_exp_stdby = rf_exp_univ_stdby if field==3
replace rating_ret_stdby = rf_ret_univ_stdby if field==3 

replace rating_exp_stdby = rf_exp_unemp_stdby if field==4
replace rating_ret_stdby = rf_ret_unemp_stdby if field==4 

replace rating_exp_stdby = rf_exp_almp_stdby if field==5
replace rating_ret_stdby = rf_ret_almp_stdby if field==5 

replace rating_exp_stdby = rf_exp_immig_stdby if field==6
replace rating_ret_stdby = rf_ret_immig_stdby if field==6 

* Estimation and storing estimates
reg rating_exp_stdby c.rating_ret_stdby##i.field, vce(cl id)
margins field, dydx(rating_ret_stdby) post
est store rating_fields_stdby

reg rating_exp_stdby c.rating_ret_stdby##i.field, vce(cl id)
margins, dydx(rating_ret_stdby) post
est store rating_stdby

coefplot (rating_stdby) (rating_fields_stdby), ylabel(1"Retrenchment" 2"Pensions" 3"Childcare" 4"University" 5"Unemployment" 6"ALMPs" 7"Migrants", labsize(vsmall)) xline(0) xtitle("AMEs of retrenchment ratings on  expansion ratings") legend(off)
graph save ${output}Appendix6.gph

restore

*** Appendix 7: Refer to line 206 in code

*** Appendix 8: Support for expansion and retrenchment elements of a tradeoff (from general support questions) as determinants of preferences on the respective tradeoff

gen expansion=.
label var expansion "Support for Expansion"
gen retrenchment=.
label var retrenchment "Support for Retrenchment"

* Tradeoff 1: Higher benefits for the unemployed – lowering maximum old-age pension benefits
preserve
replace expansion=exp_unemp_stdby

eststo pos_1:reg tradeoff_unemppen_stdby expansion i.country
est store toff1_pos_NC

eststo pos_2:reg tradeoff_unemppen_stdby expansion c.age##c.age female education_rec income pol_interest trade_off i.country
est store toff1_pos_C
restore

* Tradeoff 2: Higher availability of childcare - lower maximum pension
preserve
replace expansion=exp_child_stdby

eststo pos_3:reg tradeoff_childpen_stdby expansion i.country
est store toff2_pos_NC

eststo pos_4:reg tradeoff_childpen_stdby expansion c.age##c.age female education_rec income pol_interest trade_off i.country
est store toff2_pos_C
restore

* Tradeoff 3: Higher support for university means-tested – higher fees for university means-tested
preserve
replace expansion=exp_univ_stdby
replace retrenchment=ret_univ_stdby

eststo pos_5:reg tradeoff_univ_stdby expansion retrenchment i.country
est store toff3_pos_NC

eststo pos_6:reg tradeoff_univ_stdby expansion retrenchment c.age##c.age female education_rec income pol_interest trade_off i.country
est store toff3_pos_C
restore

coefplot toff1_pos_NC toff1_pos_C || toff2_pos_NC toff2_pos_C || toff3_pos_NC toff3_pos_C, keep(expansion retrenchment) plotlabels("Without controls" "With controls") bylabels(`" "Expand unemployment vs."  "retrench max. pensions" "' `""Expand childcare vs."  "retrench max. pensions" "' `""Means-tested university"  "support and fees" "') byopts(cols(3) legend(position(6))) xline(0) xscale(range(0.00 0.30))
graph save ${output}Appendix8.gph

drop expansion
drop retrenchment    

* Appendix 9: Refer to line 225 in code

* Appendix 10: Curvilinear relationship between age and number of inconsistent preferences
reg total_incons c.age##c.age female education_rec income pol_interest trade_off i.country
margins, at(age=(0(1)100))
marginsplot, xtitle(Age) ylabel(, labsize(vsmall)) ytitle("Average predicted number of inconsistent preferences")
graph save ${output}Appendix10.gph

* Appendix 11: Correlates of logical consistency including educational attainment and political interest in different models

eststo edu: reg total_incons c.age##c.age female education_rec income trade_off i.country
eststo intr: reg total_incons c.age##c.age female income pol_interest trade_off i.country
					
esttab edu intr		using 	${output}Appendix11.rtf, replace ///
					b(3) se(3) 			  ///
					eqlabel(none) ///
					nonumber mtitles("Number of inconsistent preferences" "Number of inconsistent preferences") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress label ///
					drop(*country) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

* Appendix 12: Refer to lines XX in code

* Appendix 13: AMEs of preferences for expansion and retrenchment on the acceptability of the tradeoff by age
gen expansion=.
label var expansion "Support for Expansion"
gen retrenchment=.
label var retrenchment "Support for Retrenchment"

preserve
replace expansion=rf_exp_unemp_stdby
replace retrenchment=rr_ret_maxpen_stdby

eststo tradeoff1_1: reg 	tradeoff_unemppen_stdby c.expansion##c.age##c.age c.retrenchment##c.age##c.age female education_rec pol_interest income trade_off i.country
margins, dydx(expansion) at(age=(20(10)80))
marginsplot, xtitle(Age) ylabel(, labsize(vsmall)) ytitle("AMEs of expansion preferences")  title("Expand unemployment vs. retrench max. pensions")
graph save ${output}Appendix13_Toff1_expand.gph

margins, dydx(retrenchment) at(age=(20(10)80))
marginsplot, xtitle(Age) ylabel(, labsize(vsmall)) ytitle("AMEs of retrenchment preferences")  title("Expand unemployment vs. retrench max. pensions")
graph save ${output}Appendix13_Toff1_retrench.gph

restore

preserve
replace expansion=rr_exp_child_stdby
replace retrenchment=rr_ret_maxpen_stdby

eststo tradeoff2_1: reg 	tradeoff_childpen_stdby c.expansion##c.age##c.age c.retrenchment##c.age##c.age female education_rec pol_interest income trade_off i.country
margins, dydx(expansion) at(age=(20(10)80))
marginsplot, xtitle(Age) ylabel(, labsize(vsmall)) ytitle("AMEs of expansion preferences")  title("Expand childcare vs. retrench max. pensions")
graph save ${output}Appendix13_Toff2_expand.gph

margins, dydx(retrenchment) at(age=(20(10)80))
marginsplot, xtitle(Age) ylabel(, labsize(vsmall)) ytitle("AMEs of retrenchment preferences")  title("Expand childcare vs. retrench max. pensions")
graph save ${output}Appendix13_Toff2_retrench.gph

restore

preserve
replace expansion=rr_exp_univli_stdby
replace retrenchment=rr_ret_univhi_stdby

eststo tradeoff3_1: reg 	tradeoff_univ_stdby c.expansion##c.age##c.age c.retrenchment##c.age##c.age female education_rec pol_interest income trade_off i.country
margins, dydx(expansion) at(age=(20(10)80))
marginsplot, xtitle(Age) ylabel(, labsize(vsmall)) ytitle("AMEs of expansion preferences")  title("Expand support for low-income vs. higher fees for high-income")
graph save ${output}Appendix13_Toff3_expand.gph

margins, dydx(retrenchment) at(age=(20(10)80))
marginsplot, xtitle(Age) ylabel(, labsize(vsmall)) ytitle("AMEs of retrenchment preferences")  title("Expand support for low-income vs. higher fees for high-income")
graph save ${output}Appendix13_Toff3_retrench.gph

restore

drop expansion
drop retrenchment

* Appendix 14: AMEs of preferences for expansion and retrenchment on acceptability of tradeoffs when including education and political interest in separate models

gen expansion=.
label var expansion "Support for Expansion"
gen retrenchment=.
label var retrenchment "Support for Retrenchment"
label var trade_off "Perceptions of tradeoffs"

preserve
replace expansion=rf_exp_unemp_stdby
replace retrenchment=rr_ret_maxpen_stdby
eststo tradeoff1_edu: reg 	tradeoff_unemppen_stdby c.expansion##c.education_rec c.retrenchment##c.education_rec c.age##c.age female income trade_off i.country
est store t1_edu
eststo tradeoff1_intr: reg 	tradeoff_unemppen_stdby c.expansion##c.pol_interest c.retrenchment##c.pol_interest c.age##c.age female income trade_off i.country
est store t1_intr
restore

preserve
replace expansion=rr_exp_child_stdby
replace retrenchment=rr_ret_maxpen_stdby
eststo tradeoff2_edu: reg 	tradeoff_childpen_stdby c.expansion##c.education_rec c.retrenchment##c.education_rec c.age##c.age female income trade_off i.country
est store t2_edu
eststo tradeoff2_edu: reg 	tradeoff_childpen_stdby c.expansion##c.pol_interest c.retrenchment##c.pol_interest c.age##c.age female income trade_off i.country
est store t2_intr
restore

preserve
replace expansion=rr_exp_univli_stdby
replace retrenchment=rr_ret_univhi_stdby
eststo tradeoff3_edu: reg 	tradeoff_univ_stdby c.expansion##c.education_rec c.retrenchment##c.education_rec c.age##c.age female income trade_off i.country
est store t3_edu
eststo tradeoff3_intr: reg 	tradeoff_univ_stdby c.expansion##c.pol_interest c.retrenchment##c.pol_interest c.age##c.age female income trade_off i.country
est store t3_intr
restore

drop expansion
drop retrenchment

coefplot t1_edu t1_intr || t2_edu t2_intr || t3_edu t3_intr, keep(c.expansion#c.education_rec c.retrenchment#c.education_rec c.expansion#c.pol_interest c.retrenchment#c.pol_interest) xline(0) coeflabels(c.expansion#c.education_rec= "Expansion*Education" c.retrenchment#c.education_rec= "Retrenchment*Education" c.expansion#c.pol_interest= "Expansion*Political interest" c.retrenchment#c.pol_interest= "Retrenchment*Political interest") legend(off) byopts(cols(3) legend(off)) bylabels(`" "Expand unemployment vs."  "retrench max. pensions" "' `""Expand childcare vs."  "retrench max. pensions" "' `""Means-tested university"  "support and fees" "')
graph save ${output}Appendix14.gph, replace

* Appendix 17: Analyses of logical and relational constraint by ideological extremeness

*** Figure A.17.1. Curvilinear relationship between ideological placement and number of inconsistent preferences
reg total_incons c.age##c.age c.ideology##c.ideology female education_rec income pol_interest trade_off i.country
margins, at(ideology=(0(1)10))
marginsplot, xtitle(Ideological left-right placement) ylabel(, labsize(vsmall)) ytitle("Average predicted number of inconsistent preferences")
graph save ${output}Appendix17_1.gph

*** Table A.17.2. Estimation of number of inconsistent preferences by ideological extremeness
recode ideology (0/2=1) (3/7=0) (8/10=1), gen(extreme)
label var extreme "Ideological extremeness"
eststo ex: reg total_incons c.age##c.age i.extreme female education_rec income pol_interest trade_off i.country

esttab ex		using 	${output}Appendix17_2.rtf, replace ///
					b(3) se(3) 			  ///
					eqlabel(none) ///
					nonumber mtitles("Number of inconsistent preferences") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress label ///
					drop(*country) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

*** Figure A.17.3. Preference for expansion and retrenchment elements of a tradeoff as determinants of preferences on the respective tradeoff when controlling for ideological extremeness
gen expansion=.
label var expansion "Support for Expansion"
gen retrenchment=.
label var retrenchment "Support for Retrenchment"

preserve
replace expansion=rf_exp_unemp_stdby
replace retrenchment=rr_ret_maxpen_stdby
eststo sd_1:reg tradeoff_unemppen_stdby expansion retrenchment i.country
est store toff1_NC
eststo sd_2:reg tradeoff_unemppen_stdby expansion retrenchment c.age##c.age female education_rec income pol_interest trade_off i.extreme i.country
est store toff1_C
restore

preserve
replace expansion=rr_exp_child_stdby
replace retrenchment=rr_ret_maxpen_stdby
eststo sd_3:reg tradeoff_childpen_stdby expansion retrenchment i.country
est store toff2_NC
eststo sd_4:reg tradeoff_childpen_stdby expansion retrenchment c.age##c.age female education_rec income pol_interest trade_off i.extreme i.country
est store toff2_C
restore

preserve
replace expansion=rr_exp_univli_stdby
replace retrenchment=rr_ret_univhi_stdby
eststo sd_5:reg tradeoff_univ_stdby expansion retrenchment i.country
est store toff3_NC
eststo sd_6:reg tradeoff_univ_stdby expansion retrenchment c.age##c.age female education_rec income pol_interest trade_off i.extreme i.country
est store toff3_C
restore

coefplot toff1_NC toff1_C || toff2_NC toff2_C || toff3_NC toff3_C, keep(expansion retrenchment) plotlabels("Without controls" "With control for extreme ideology") bylabels(`" "Expand unemployment vs."  "retrench max. pensions" "' `""Expand childcare vs."  "retrench max. pensions" "' `""Means-tested university"  "support and fees" "') byopts(cols(3) legend(position(6))) xline(0) xscale(range(0.05 0.30))
graph save ${output}Appendix17_3.gph, replace

drop expansion
drop retrenchment 

*** Figure A.14.4 Effect of preferences for expansion and retrenchment elements of a tradeoff as determinants of preferences on respective tradeoff by ideological extremeness

gen expansion=.
label var expansion "Support for Expansion"
gen retrenchment=.
label var retrenchment "Support for Retrenchment"

preserve
replace expansion=rf_exp_unemp_stdby
replace retrenchment=rr_ret_maxpen_stdby
eststo tradeoff1_ex: reg 	tradeoff_unemppen_stdby c.expansion##i.extreme c.retrenchment##i.extreme c.age##c.age female education_rec pol_interest income trade_off i.country
est store t1_int_ex
restore

preserve
replace expansion=rr_exp_child_stdby
replace retrenchment=rr_ret_maxpen_stdby
eststo tradeoff2_ex: reg 	tradeoff_childpen_stdby c.expansion##i.extreme c.retrenchment##i.extreme c.age##c.age  female education_rec pol_interest income trade_off i.country
est store t2_int_ex
restore

preserve
replace expansion=rr_exp_univli_stdby
replace retrenchment=rr_ret_univhi_stdby
eststo tradeoff3_ex: reg 	tradeoff_univ_stdby c.expansion##i.extreme c.retrenchment##i.extreme c.age##c.age female education_rec pol_interest income trade_off i.country
est store t3_int_ex
restore

drop expansion
drop retrenchment

coefplot t1_int_ex || t2_int_ex || t3_int_ex, keep(1.extreme#c.expansion 1.extreme#c.retrenchment) xline(0) coeflabels(1.extreme#c.expansion= "Expansion*Extreme" 1.extreme#c.retrenchment="Retrenchment*Extreme") legend(off) byopts(cols(3) legend(off)) bylabels(`" "Expand unemployment vs."  "retrench max. pensions" "' `""Expand childcare vs."  "retrench max. pensions" "' `""Means-tested university"  "support and fees" "')
graph save ${output}Appendix17_4.gph, replace


*** Appendix 18: Analyses of logical and relational constraint by response time
gen minconjoint = timeconjoint/60

*** Figure A.18.1 Linear effect of response time in conjoint on number of inconsistent replies
eststo time: reg total_incons c.age##c.age female education_rec income pol_interest trade_off minconjoint i.country
coefplot, drop (*.country _cons) xline(0) ylabel(1"Age" 2"Age squared" 3"Female" 4"Education level" 5"Income" 6"Political interest" 7"Tradeoff perceptions" 8"Minutes conjoints", labsize(vsmall)) xlabel(, labsize(small)) xtitle(Effect on number of inconsistent preferences)
graph save ${output}Appendix18_1.gph

*** Figure A.18.2 Effect of preferences for expansion and retrenchment elements of a tradeoff as determinants of preferences on the respective tradeoff by response time

gen expansion=.
label var expansion "Support for Expansion"
gen retrenchment=.
label var retrenchment "Support for Retrenchment"

preserve
replace expansion=rf_exp_unemp_stdby
replace retrenchment=rr_ret_maxpen_stdby
eststo tradeoff1_min: reg 	tradeoff_unemppen_stdby c.expansion##c.minconjoint c.retrenchment##c.minconjoint c.age##c.age  female education_rec pol_interest income trade_off i.country
est store t1_min
restore

preserve
replace expansion=rr_exp_child_stdby
replace retrenchment=rr_ret_maxpen_stdby
eststo tradeoff2_min: reg 	tradeoff_childpen_stdby c.expansion##c.minconjoint c.retrenchment##c.minconjoint c.age##c.age  female education_rec pol_interest income trade_off i.country
est store t2_min
restore

preserve
replace expansion=rr_exp_univli_stdby
replace retrenchment=rr_ret_univhi_stdby
eststo tradeoff3_min: reg 	tradeoff_univ_stdby c.expansion##c.minconjoint c.retrenchment##c.minconjoint c.age##c.age female education_rec pol_interest income trade_off i.country
est store t3_min
restore

drop expansion
drop retrenchment

coefplot t1_min || t2_min || t3_min, keep(c.expansion#c.minconjoint c.retrenchment#c.minconjoint) xline(0) coeflabels(c.expansion#c.minconjoint= "Expansion*Minutes conjoint" c.retrenchment#c.minconjoint="Retrenchment*Minutes conjoint") legend(off) byopts(cols(3) legend(off)) bylabels(`" "Expand unemployment vs."  "retrench max. pensions" "' `""Expand childcare vs."  "retrench max. pensions" "' `""Means-tested university"  "support and fees" "')
graph save ${output}Appendix18_2.gph

* Appendix 15: Robustness checks with European Social Survey data

use ${original}ESS8e02_1, clear

recode gndr (1=0) (2=1), gen(gender)
gen pol_interest= (polintr*-1)+4
encode(cntry), gen(country)
recode eisced (55=.)
egen eduunmp_std = std(eduunmp)
egen gvslvue_std = std(gvslvue)

label var gvslvue_std "Expand standard of living unemployed"
label var agea "Age"
label var gender "Female"
label var eisced "Educational attainment"
label var hinctnta "Income"
label var pol_interest "Political interest"

*** Table A.15.1 Tradeoff: Spending more on education for the unemployed at the cost of cutbacks in unemployment benefits
eststo tradeoff1_1: reg eduunmp_std c.gvslvue_std c.agea gender eisced hinctnta pol_interest i.country
eststo tradeoff1_2: reg eduunmp_std c.gvslvue_std##c.agea gender eisced hinctnta pol_interest i.country
eststo tradeoff1_3: reg eduunmp_std c.gvslvue_std##i.gender agea eisced hinctnta pol_interest i.country
eststo tradeoff1_4: reg eduunmp_std c.gvslvue_std##c.eisced agea gender hinctnta pol_interest i.country
eststo tradeoff1_5: reg eduunmp_std c.gvslvue_std##c.hinctnta agea gender eisced pol_interest i.country
eststo tradeoff1_6: reg eduunmp_std c.gvslvue_std##c.pol_interest agea gender eisced hinctnta i.country

esttab tradeoff1_1 tradeoff1_2 tradeoff1_3 tradeoff1_4 tradeoff1_5 tradeoff1_6 ///
					using 	${output}Appendix15_1.rtf, replace ///
					b(3) se(3) 			  ///
					label   	interaction(" X ")		///
					eqlabel(none) ///
					nonumber mtitles("Education for unemployed vs. Unemployment benefits" "Education for unemployed vs. Unemployment benefits" "Education for unemployed vs. Unemployment benefits" "Education for unemployed vs. Unemployment benefits" "Education for unemployed vs. Unemployment benefits" "Education for unemployed vs. Unemployment benefits") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress ///
					drop(*country) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

*** Table A.15.2 Tradeoff: Spending more on benefits for parents to combine work and family at the cost of higher taxes					
egen wrkprbf_std = std(wrkprbf)
egen gvcldcr_std = std(gvcldcr)
egen sbbsntx_std = std(sbbsntx)
label var gvcldcr_std "Childcare govts' responsibility"
label var sbbsntx_std "Social benefits cost businesses too much taxes"
	

eststo tradeoff2_1: reg wrkprbf_std c.gvcldcr_std c.sbbsntx_std agea gender eisced hinctnta pol_interest i.country
eststo tradeoff2_2: reg wrkprbf_std c.gvcldcr_std##c.agea c.sbbsntx_std##c.agea gender eisced hinctnta pol_interest i.country
eststo tradeoff2_3: reg wrkprbf_std c.gvcldcr_std##i.gender c.sbbsntx_std##i.gender agea eisced hinctnta pol_interest i.country
eststo tradeoff2_4: reg wrkprbf_std c.gvcldcr_std##c.eisced c.sbbsntx_std##c.eisced agea gender hinctnta pol_interest i.country
eststo tradeoff2_5: reg wrkprbf_std c.gvcldcr_std##c.hinctnta c.sbbsntx_std##c.hinctnta agea gender eisced pol_interest i.country
eststo tradeoff2_6: reg wrkprbf_std c.gvcldcr_std##c.pol_interest c.sbbsntx_std##c.pol_interest agea gender eisced hinctnta pol_interest i.country

esttab tradeoff2_1 tradeoff2_2 tradeoff2_3 tradeoff2_4 tradeoff2_5 tradeoff2_6 ///
					using 	${output}Appendix15_2.rtf, replace ///
					b(3) se(3) 			  ///
					label   	interaction(" X ")		///
					eqlabel(none) ///
					nonumber mtitles("Benefits for working parents vs. Higher taxes" "Benefits for working parents vs. Higher taxes" "Benefits for working parents vs. Higher taxes" "Benefits for working parents vs. Higher taxes" "Benefits for working parents vs. Higher taxes" "Benefits for working parents vs. Higher taxes") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress ///
					drop(*country) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)
					
* Appendix 16: Robustness checks with INVEDUC data

use ${original}ZA6961_v1-0-0, clear

recode Q36 (8/9=.)
recode Q3801 (8/9=.)
recode Q3802 (8/9=.)
foreach var of varlist Q23_* {
recode `var'(8/9=.)
}
recode Q12 (9=.) (1=0) (2=1), gen(gender)
foreach var of varlist Q64* {
recode `var'(98/99=.)
}
gen education=.
foreach var of varlist Q64* {
replace education = `var' if `var'!=.
}

egen Q36_std = std(Q36)
egen Q23_6_std = std(Q23_6)
egen Q23_3_std = std(Q23_3)
egen Q3802_std = std(Q3802)
egen Q23_2_std = std(Q23_2)
egen Q23_5_std = std(Q23_5)

label var Q23_6_std "Spending in education"
label var Q23_3_std "Spending in old age pensions" 
label var age "Age"
label var gender "Female"
label var education "Educational attainment"
label var hhincome "Income"
label var Q23_3_std "Spending in old age pensions"
label var Q23_2_std "Spending in unemployment benefits"
label var Q23_5_std "Spending in family support"
label var Q23_6_std "Spending in education"

* Table A.16.1 Tradeoff: Spending more on education at the cost of reducing spending in old age pensions
eststo clear
eststo tradeoff1_1: reg Q36_std c.Q23_6_std c.Q23_3_std age gender education hhincome i.countryno
eststo tradeoff1_2: reg Q36_std c.Q23_6_std##c.age c.Q23_3_std##c.age gender education hhincome i.countryno
eststo tradeoff1_3: reg Q36_std c.Q23_6_std##i.gender c.Q23_3_std##i.gender age education hhincome i.countryno
eststo tradeoff1_4: reg Q36_std c.Q23_6_std##c.education c.Q23_3_std##c.education age gender hhincome i.countryno
eststo tradeoff1_5: reg Q36_std c.Q23_6_std##c.hhincome c.Q23_3_std##c.hhincome age gender education i.countryno

esttab tradeoff1*		using 	${output}Appendix16_1.rtf, replace ///
					b(3) se(3) 			  ///
					label   	interaction(" X ")		///
					eqlabel(none) ///
					nonumber mtitles("Expansion education vs. Pensions" "Expansion education vs. Pensions" "Expansion education vs. Pensions" "Expansion education vs. Pensions" "Expansion education vs. Pensions") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress ///
					drop(*countryno) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

* Table A.16.2. & A.16.3 Tradeoff: Spending more on pensions and unemployment benefits at the cost of reducing spending in family support and education
eststo tradeoff2_1: reg Q3802_std c.Q23_3_std c.Q23_2_std Q23_5_std Q23_6_std age gender education hhincome i.countryno
eststo tradeoff2_2: reg Q3802_std c.Q23_3_std##c.age c.Q23_2_std##c.age Q23_5_std Q23_6_std gender education hhincome i.countryno
eststo tradeoff2_3: reg Q3802_std c.Q23_3_std##i.gender c.Q23_2_std##i.gender Q23_5_std Q23_6_std age education hhincome i.countryno
eststo tradeoff2_4: reg Q3802_std c.Q23_3_std##c.education c.Q23_2_std##c.education Q23_5_std Q23_6_std age gender hhincome i.countryno
eststo tradeoff2_5: reg Q3802_std c.Q23_3_std##c.hhincome c.Q23_2_std##c.hhincome Q23_5_std Q23_6_std age gender education hhincome i.countryno

eststo tradeoff2_6: reg Q3802_std Q23_3_std Q23_2_std c.Q23_5_std##c.age c.Q23_6_std##c.age gender education hhincome i.countryno
eststo tradeoff2_7: reg Q3802_std Q23_3_std Q23_2_std c.Q23_5_std##i.gender c.Q23_6_std##i.gender age education hhincome i.countryno
eststo tradeoff2_8: reg Q3802_std Q23_3_std Q23_2_std c.Q23_5_std##c.education c.Q23_6_std##c.education age gender hhincome i.countryno
eststo tradeoff2_9: reg Q3802_std Q23_3_std Q23_2_std c.Q23_5_std##c.hhincome c.Q23_6_std##c.hhincome age gender education i.countryno
					
esttab tradeoff2_1 tradeoff2_2 tradeoff2_3 tradeoff2_4 tradeoff2_5		using 	${output}Appendix16_2.rtf, replace ///
					b(3) se(3) 			  ///
					label   	interaction(" X ")		///
					eqlabel(none) ///
					nonumber mtitles("Expansion pensions & unemployment vs. Family support & education" "Expansion pensions & unemployment vs. Family support & education" "Expansion pensions & unemployment vs. Family support & education" "Expansion pensions & unemployment vs. Family support & education" "Expansion pensions & unemployment vs. Family support & education") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress ///
					drop(*countryno) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

esttab tradeoff2_6 tradeoff2_7 tradeoff2_8 tradeoff2_9		using 	${output}Appendix16_3.rtf, replace ///
					b(3) se(3) 			  ///
					label   	interaction(" X ")		///
					eqlabel(none) ///
					nonumber mtitles("Expansion pensions & unemployment vs. Family support & education" "Expansion pensions & unemployment vs. Family support & education" "Expansion pensions & unemployment vs. Family support & education" "Expansion pensions & unemployment vs. Family support & education" "Expansion pensions & unemployment vs. Family support & education") nodiscrete nobase ///
					addnotes("All models include country fixed effects")	///
					r2	compress ///
					drop(*countryno) 	///
					star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

log close
